import {createRouter, createWebHashHistory} from "vue-router";
import Layout from "../views/layout";


const routes = [

    {
        path: "/",
        component: Layout,
        redirect: '/home',
        children: [
            {
                path: "/home",
                name: "首页",
                component: () =>
                    import( "../views/home/index"),
            },
            {
                path: "/user",
                name: "用户管理",
                component: () =>
                    import( "../views/user"),
            },
            {
                path: "/bigType",
                name: "商品大类管理",
                component: () =>
                    import( "../views/bigType"),
            },
            {
                path: "/smallType",
                name: "商品小类管理",
                component: () =>
                    import( "../views/smallType"),
            },
            {
                path: "/product",
                name: "商品管理",
                component: () =>
                    import( "../views/product"),
            },
            {
                path: "/order",
                name: "订单管理",
                component: () =>
                    import( "../views/order"),
            },
            {
                path: "/analysis",
                name: "订单分析",
                component: () =>
                    import( "../views/orderAnalysis"),
            },
            {
                path: "/modifyPassword",
                name: "修改密码",
                component: () =>
                    import( "../views/modifyPassword"),
            },
            {
                path: "/note",
                name: "笔记管理",
                component: () =>
                    import( "../views/note"),
            },
            {
                path: "/portfolio",
                name: "作品管理",
                component: () =>
                    import( "../views/portfolio"),
            },
            {
                path: "/customer-service",
                name: "客服消息",
                component: () => import("../views/customer-service/index"),
            },
            {
                path: "/customer-service-manage",
                name: "客服管理",
                component: () => import("../views/customer-service-manage/index"),
            }
        ]
    },
    {
        path: "/login",
        name: "Login",
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import( "../views/login"),
    },
    {
        path: '/portfolio',
        component: Layout,
        children: [
            {
                path: 'index',
                component: () => import('@/views/portfolio/index'),
                name: 'Portfolio',
                meta: { title: '作品集管理', icon: 'el-icon-picture' }
            }
        ]
    }
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;
